using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Data;
using System.Text;
using System.Windows.Forms;
using System.IO;
using Athena.Objects;
using Athena.Tools;

using WeifenLuo.WinFormsUI.Docking;

namespace SequenceViewerPlugin
{

    public partial class SequenceViewPanel : DockContent
    {

        public SequenceViewPanel()
        {
            InitializeComponent();

            Text = "Canvas";
            pnlCanvas.BindScrollbars(vScrollBar1, hScrollBar1);

        }   

        private void pnlCanvas_MouseDown(object sender, MouseEventArgs e)
        {
            
            pnlCanvas.Invalidate();
        }

        void pnlCanvas_MouseDoubleClick(object sender, System.Windows.Forms.MouseEventArgs e)
        {
           
        }

        private void pnlCanvas_MouseUp(object sender, MouseEventArgs e)
        {

        }
        private void pnlCanvas_MouseMove(object sender, MouseEventArgs e)
        {
            
        }


        private void pnlCanvas_MouseLeave(object sender, EventArgs e)
        {
            pnlCanvas.Invalidate();
        }

        void Zoom(int nDelta)
        {
            if (nDelta < 0)
            {
                pnlCanvas.ScaleFactor *= 0.9f; ;
            }
            else
            {
                pnlCanvas.ScaleFactor *= 1.1f;
            }
            pnlCanvas.Invalidate();
        }

        void ScrollUpDown(int nDelta)
        {
            if (nDelta < 0)
            {
                pnlCanvas.ScrollDown();
            }
            else
            {
                pnlCanvas.ScrollUp();
            }
            pnlCanvas.Invalidate();
        }

       
        private void DrawPanel_KeyDown(object sender, KeyEventArgs e)
        {
        }

        private void DrawPanel_KeyUp(object sender, KeyEventArgs e)
        {
            
        }

        void DrawPanel_MouseWheel(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            if (e.Delta != 0)
            {
                if ((ModifierKeys & Keys.Control) == Keys.Control)
                {
                    Zoom(e.Delta / 120);
                }
                else
                {
                    ScrollUpDown(e.Delta / 120);
                }
            }
        }

        private void pnlCanvas_MouseHover(object sender, EventArgs e)
        {
            
        }
    }
}
